package vip.ola.core.service.code;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import vip.ola.core.entity.code.CodeInfo;

import java.math.BigDecimal;
import java.util.List;


/**
 * <p>
 * 二维码信息 服务类
 * </p>
 *
 * @author faker
 * @since 2020-03-25
 */
public interface CodeInfoService extends IService<CodeInfo> {

    IPage<CodeInfo> list(int offset, int limit, CodeInfo codeInfo);

    CodeInfo getCacheById(long id);

    String getCodeUrlByCache(long id);

    CodeInfo getByCodeInfo(CodeInfo codeInfo);

    CodeInfo getByCodeUrl(String codeUrl);

    boolean cleanCodeCollInfo(Long codeBusId, Long agentId, Long userId);

    void updateCodeCollInfo(long codeId, BigDecimal profit, Integer orderStatus, BigDecimal orderAmount);

    boolean updateStatus(long codeId, int status);

    List<CodeInfo> getAvailableQrCode(Long codeBusId, Integer codeType, BigDecimal amount,  boolean needThirdId, int offset, int availableLimit);

    List<CodeInfo> getAvailableBestQrCode(Long codeBusId, Integer codeType, BigDecimal amount,  boolean needThirdId, int offset, int availableLimit);

    int updateCodeAgentRate(long agentId, BigDecimal rate);

    int updateCodeBusRate(long codeBusId, BigDecimal rate);

    int updateFailWeight(List idList, int weight);
}
